<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>网络U盘</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
#id_changchuan_div {
	margin-top: 50px;
}

#form,form {
	width: 260px;
	font-size: 18px;
}

input {
	width: 100%;
	font-size: 18px;
}
#tabl {
	width: 40%;
	margin-top:10px;
	text-align: center;
}
#tabl tr{
	font-size: 18px;
}
.tr1{
	font-size: 22px;
	font-weight: bold;
}
.tishi{
	font-size: 22px;
	background-color: #eee;
}
</style>
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
	$(function(){
		query();
	});

	function selchange(){
		var sel=$("#sel").val();
		var htm="<tr><td><input type='file' name='file'></td></tr>";
		if(sel=="1"){
			htm="<input type='file' name='file'>";
		}else if(sel=="2"){
			htm=htm+htm;
		}else if(sel=="3"){
		htm=htm+htm+htm;		
		}
		$("#form").html(htm);
	};
	function query(){
		$.post("myfile/queryfiles",function(data){
			var htm="<tr class='tr1' ><td>文件名</td><td>文件大小</td><td>上传日期</td><td>操作</td>;</tr>";
			if(data==""){
				htm=htm+"<tr class='tishi' ><td colspan='5' >没有找到匹配记录</td></tr>";
			}else{
				$.each(data,function(index,file){
				htm=htm+"<tr><td>"+file.wangpan_filename+"</td><td>"+file.wangpan_filesize+"kb</td><td>"+file.wangpan_uploaddate+"</td><td><a href='./myfile/delete?fileid="+file.wangpan_fileid+"'>删除</a></td>;</tr>";
				});
			}
			$("#tabl").html(htm);
		});
	};



</script>
</head>

<body>
	<h1>网络U盘</h1>
	欢迎
	<b style="font-size: 24px;color: purple;">${name }</b>登录
	<a href="./index.jsp">退出</a>
	<table id="tabl">
	
	</table>


	<div id="id_changchuan_div">
		上传文件的数量：<select id="sel" onchange="selchange()">
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
		</select>
		<form action="<%=path %>/myfile/upload" method="post" enctype="multipart/form-data">
			<table id="form">
				<tr>
					<td><input type="file" name="file"></td>
				</tr>

			</table>
			<input type="submit" value="上传">
		</form>

	</div>

</body>
</html>
